//
//  WebserviceManager.h
//  Volatix
//
//  Created by Familly on 6/11/14.
//  Copyright (c) 2014 Familly. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFHTTPRequestOperationManager.h"

typedef enum {
    ENUM_API_REQUEST_UPDATE_DATA_REAL_TIME = 0,
    ENUM_API_REQUEST_GET_LIST_DYNAMIC_COLUMN = 1,
    ENUM_API_REQUEST_LIST_ISO = 2,
    ENUM_API_REQUEST_LIST_LOADZONE = 3,
    ENUM_API_REQUEST_LIST_POWERPOINT = 4,
    ENUM_API_REQUEST_UPDATE_DATA_DAY_AHEAD = 5 ,
    ENUM_API_REQUEST_GET_HISTORY = 6 ,
    ENUM_API_REQUEST_LOGIN = 7 ,
    ENUM_API_REQUEST_LOGOUT = 8 ,
    ENUM_API_REQUEST_AAAAAA = 9,
}ENUM_API_REQUEST_TYPE;



typedef enum {
    enumAPIRequestMethod_GET,
    enumAPIRequestMethod_POST, // post object
    enumAPIRequestMethod_POST_ARRAY,
    enumAPIRequestMethod_PUT,
    enumAPIRequestMethod_Num
}enumAPIRequestMethodKind;

typedef void(^WebserviceManagerUploadProgressBlock)(NSUInteger bytesWritten, NSInteger totalBytesWritten, NSInteger totalBytesExpectedToWrite);
typedef void(^WebserviceManagerCompleteBlock)(id responseObject);
typedef void(^WebserviceManagerFailureBlock)(NSError *error);

@interface WebserviceManager : AFHTTPRequestOperationManager
+ (WebserviceManager *)sharedInstance;
- (NSString *)fullURLRequestWithAPI:(NSString *)strApiUrl;

- (AFHTTPRequestOperation *)operationWithType:(ENUM_API_REQUEST_TYPE)type
                            andPostMethodKind:(int)methodKind
                                    andParams:(NSMutableDictionary *)params
                                    andString:(NSString *)strBody
                                       inView:(UIView *)view
                                completeBlock:(void (^)(id responseObject))block
                                 failureBlock:(void (^)(NSError *error))failureBlock;

/*
// User business methods
- (void)requestLoginWithDelegate:(id)delegate
                       requestID:(NSString *)requestID
                           email:(NSString *)strEmail
                         andPass:(NSString *)strPass;

- (void)requestMembershipWithDelegate:(id)delegate
                            requestID:(NSString *)requestID
                             fullName:(NSString *)strFullName
                                email:(NSString *)strEmail
                          phoneNumber:(NSString *)strPhoneNumber
                              company:(NSString *)strCompany;

- (void)requestActiveRentalsWithDelegate:(id)delegate
                               requestID:(NSString *)requestID
                               authToken:(NSString *)authToken
                                   email:(NSString *)strEmail;

- (void)requestInternalJobsWithDelegate:(id)delegate
                              requestID:(NSString *)requestID;

- (void)requestRentalMessagesWithDelegate:(id)delegate
                                requestID:(NSString *)requestID
                                 rentalId:(int)rentalId;

- (void)requestSendMessageWithDelegate:(id)delegate
                             requestID:(NSString *)requestID
                              rentalId:(int)rentalId
                        messageContent:(NSString *)strMessage;

- (void)requestRentalActionWithDelegate:(id)delegate
                              requestID:(NSString *)requestID
                               rentalId:(int)rentalId;

- (void)requestExtendRentalWithDelegate:(id)delegate
                              requestID:(NSString *)requestID
                               rentalId:(int)rentalId
                              startDate:(NSDate *)startDate
                                endDate:(NSDate *)endDate;

- (void)requestCallOffRentalWithDelegate:(id)delegate
                               requestID:(NSString *)requestID
                                rentalId:(int)rentalId
                                  reason:(NSString *)strReason;

- (void)requestFeaturedItemWithDelegate:(id)delegate
                              requestID:(NSString *)requestID;

- (void)requestUserTotalWithDelegate:(id)delegate
                           requestID:(NSString *)requestID;

- (void)requestUserNotificationsWithDelegate:(id)delegate
                                        page:(NSInteger)page
                                   requestID:(NSString *)requestID;

// normal request
- (AFHTTPRequestOperation *)operationWithType:(ENUM_API_REQUEST_TYPE)type andPostMethodKind:(BOOL)methodKind andParams:(NSMutableDictionary *)params inView:(UIView *)view completeBlock:(void (^)(id responseObject))block failureBlock:(void (^)(NSError *error))failureBlock;

// multipart request
- (AFHTTPRequestOperation *)operationMultiPartWithType:(ENUM_API_REQUEST_TYPE)type andParams:(NSMutableDictionary *)params withValues:(NSArray *)values andKeys:(NSArray*)keys inView:(UIView *)view progressBlock:(WebserviceManagerUploadProgressBlock)progressBlock completeBlock:(WebserviceManagerCompleteBlock)completeBlock failureBlock:(WebserviceManagerFailureBlock)failureBlock;
*/
@end
